//
//  YSRoomModel.m
//  Yaoyle
//
//  Created by ZhaoXudong on 14-9-24.
//  Copyright (c) 2014年 ZhaoXudong. All rights reserved.
//

#import "YSRoomModel.h"
#import "YSUtility.h"
#import "YSType.h"

@implementation YSRoomModel

- (id)initWithDict:(NSDictionary *)dict {
    self = [super init];
    if (self) {
        NSDictionary *d = [YSUtility returnDictionary:dict];

        self.roomNo = d[RoomNO];
        
        NSNumber *temp;// = [NSNumber numberWithInt:[d[RoomId] integerValue]];
        self.roomId = d[RoomId];//[temp stringValue];
        
        temp = [NSNumber numberWithInt:[d[RoomGamerNum] integerValue]];
        self.roomNum = [temp integerValue];
        
        temp = [NSNumber numberWithInt:[d[RoomMaxGamerNum] integerValue]];
        self.roomMaxNum = [temp integerValue];
        
        temp = [NSNumber numberWithInt:[d[RoomScore] integerValue]];
        self.roomScore = [temp stringValue];
        
        temp = [NSNumber numberWithInt:[d[RoomStatus] integerValue]];
        self.roomStatus = [temp integerValue];
    }
    return self;
}

- (BOOL)isWaitGame {
    if (self.roomStatus == eGameWait) {
        return YES;
    }
    return NO;
}

- (BOOL)isMaxNum {
    if (self.roomNum >= self.roomMaxNum) {
        return YES;
    }
    return NO;
}

@end
